
TARGET ?= a
TOPDIR ?= $(shell pwd)/..
CFLAGS := -I"$(TOPDIR)/include"   
LDFLAGS := -L"$(TOPDIR)/bin"  -lpthread

OBJS   := $(foreach obj,${TARGET},$(obj).o)
SOURCE := $(foreach obj,${TARGET},$(obj).c)

all: $(OBJS) $(TARGET) 

$(TARGET):$(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS)

%.o:%.c
	$(CC) -g -c -o $@ $^ $(CFLAGS) 
	
.PHONY: clean
clean:
	rm -f *.*~ *~ *.o $(TARGET)

